package com.neusoft.chanceserver.controller;


import com.neusoft.chanceserver.dto.RespBean;
import com.neusoft.chanceserver.dto.TrackAdd;
import com.neusoft.chanceserver.entity.Track;
import com.neusoft.chanceserver.service.IChanceService;
import com.neusoft.chanceserver.service.ITrackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 机会跟踪记录表 前端控制器
 * </p>
 *
 * @author liuxp
 * @since 2021-07-12
 */
@RestController
@RequestMapping("/chance")
public class TrackController {
    @Autowired
    ITrackService iTrackService;

    @PostMapping("/searchTrack/{chanceId}")
    RespBean searchTrackByChanceId(@PathVariable Integer chanceId){
        return iTrackService.searchTrackByChanceId(chanceId);
    }

    @PostMapping("/addTrack")
    RespBean addTrack(@RequestBody TrackAdd trackAdd){
        return iTrackService.addTrack(trackAdd);
    }

    @PostMapping("/deleteTrack/{trackId}")
    RespBean deleteTrack(@PathVariable Integer trackId){
        return iTrackService.deleteTrack(trackId);
    }

    @PostMapping("/updateTrack")
    RespBean updateTrack(@RequestBody Track track){
        return iTrackService.updateTrack(track);
    }
}

